Tip: adapt git configuration to use your favourite editor
git config --global core.editor gedit
README.mdgit status and git diffgit commit:
Write commit message in editor:
git commit README.mdWrite commit message inline:
git commit -m 'Proper commit message README.md'Command git push:
git push origin masterREADME.md locallygit add -p README.md
Update your README.md on GitHub,
on a line you also edited locally
git pull origin master
Open README.md in text editor:
<<<<<<< HEAD
A simple analysis to visualize my favourite fruit colour.
=======
A simple analysis to discover my favourite fruit color.
>>>>>>> origin/masterChoose what you want to keep:
A simple analysis to discover my favourite fruit colour.Commit and push
git add <fixed files>
git commit
git push origin masterfruits.csv file in a /data directoryREADME.mdgit commit -am "My message"
takes all changes in a single commit
git add data/fruits.csv
git commit -am "Add data file"
git push origin master
git revert HEAD
Tip: git revert can be applied for more functionality.
See this tutorial for more in depth information on undoing commits.
Tip: git checkout -- <file-name> will undo changes
to file since last commit (!no log of your changes)
Tip: git reset HEAD~ will unstage changes
(similar to Github Desktop)
git loggit checkout HASHgit checkout master/src directoryCreate a branch by a checkout to new branch, git checkout -b:
git checkout -b analysis-scriptgit branchgit add a file to the repositoryGo back to the status of the master:
git checkout masterGo back to the status of the new branch:
git checkout analysis-scriptgit push origin analysis-script
git fetch origin
git checkout master
git merge --ff-only origin/master
git branch -d analysis-script
Cfr. local merge: git checkout master and git merge analysis-script
.gitignore to the rescue!
git checkout masterpassword.txt with the words SECRETgit status and git diff.gitignore to exclude the password.txt filegit status and git diffgit commit your adaptation to the .gitignore filegit push your changes to GitHub.gitignore file on GitHubmaster branchWorking local - merging online
clone the other repository to your local computerbranch with a different namecommit your adaptationpush your branch to the remote repositorypull requestmerge online when appropriateTip: All functionalities are available in the previous sections
Once you are satisfied with the status of your analysis, it makes sense to create a release:
Follow this tutorial to create a release.
As an example, give it your flavour:
alias gcl='git clone'
alias gs='git status'
alias gd='git diff --word-diff'
alias ga='git add'
alias gap='git add -p'
alias gcm='git commit -v -m'
alias gcam='git commit -am'
alias gch='git checkout'
alias gchb='git checkout -b'
alias gfo='git fetch origin'
alias gm='git merge'
alias gpl='git pull'
alias gps='git push'
alias gplom='git pull origin master'
alias gpsom='git push origin master'
alias gplfm='git fetch origin; git checkout master; git merge --ff-only origin/master'
alias glog="git log --graph --pretty=format:'%C(bold)%h%Creset%C(magenta)%d%Creset %s %C(yellow)<%an> %C(cyan)(%cr)%Creset' --abbrev-commit --date=relative"
There’s no such thing, as a free lunch…
Information combined at INBO Tutorials website.
You’re welcome to provide issues, pull requests,…